#!/usr/bin/env python
# -*- coding:utf-8 -*-

# https://www.cnblogs.com/kaituorensheng/p/3287652.html
# pyhon之Tkinter实例化学习

import tkinter
from public_function import dict_choice

'''Button
说明
　　创建按钮
用法
　　Button(根对象, [属性列表])
'''


def test_1():
    root = tkinter.Tk()
    root.title("Button")
    root.geometry()
    root.resizable(width=False, height=True)  # 宽不可变, 高可变,默认为True

    def printhello():
        t.insert('1.0', "hello\n")

    t = tkinter.Text()
    t.pack()
    tkinter.Button(root, text="press", command=printhello).pack()
    root.mainloop()


def test_2():
    button = tkinter.Button(text='fuzhiqiangButton', padx=150, pady=50)  # 布局相关的padx   X轴的间距
    button.config(cursor='gumby')
    button.config(bd=8, relief=tkinter.RAISED)  # bd  边界     relief  图标效果
    button.config(bg='green', fg='yellow')  # 背景色
    button.config(font=('Helvetica', 10, 'bold italic'))  # 字体
    button.pack()
    button.mainloop()


def main():
    from public_function import dict_choice
    choice = str(input("Enter a positive integer to choice: "))
    if choice in dict_choice.keys():
        exec(dict_choice[choice])
    else:
        print("输入有误，请重输！", choice)


if __name__ == '__main__':
    main()
